package com.suray.socket.type;

public enum SocketType {
    CLIENT(1, "客户端"),
    SERVER(2, "服务端"),
    ;

    private int value;
    private String des;

    SocketType(int value, String des) {
        this.value = value;
        this.des = des;
    }

    public int getValue() {
        return value;
    }

    public static SocketType parseType(int value) {
        for (SocketType type : SocketType.values()) {
            if (type.getValue() == value) {
                return type;
            }
        }

        return null;
    }

    @Override
    public String toString() {
        return des;
    }
}
